<%@ page language="java" session="true" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ page import="java.io.File"%>
<%@ page import="java.util.Date" %>
<%
        response.setHeader("Expires", "-1");
        response.setHeader("Cache-Control", "no-store");
        response.setHeader("Pragma", "no-cache");
        
		// Get application name
		String appName = (String) session.getAttribute("ServerPath");
		if (appName==null)
		{
%>
			<jsp:forward page="/AdminLogin"/>
<%
		}
		appName = appName.substring(0,appName.length()-1);
		appName = appName.substring(appName.lastIndexOf('/') + 1);

		// Set images
		String imagePath = "images/default";
		String appPath = System.getProperty("catalina.home");
		if (appPath.indexOf('\\') >= 0)
		    appPath = appPath.replace('\\', '/');
		appPath = appPath + "/webapps/" + (String)session.getAttribute("Service") + "/";
		String serviceImagePath = appPath + "images/" + (String) session.getAttribute("ServerName");
		String customImagePath = "../" + (String)session.getAttribute("Service") + "/images/" + (String) session.getAttribute("ServerName");
		
		String logoPath = imagePath + "/ibroker-logo.gif";
		String relatedNewsPath = imagePath + "/related-news.gif";
		String bannerPath = (String) session.getAttribute("Banner");
		if (("".equals(bannerPath)) || (bannerPath.startsWith("images")))
			bannerPath = imagePath + "/ad-banner.gif";
		
		File file = new File(serviceImagePath+"/ibroker-logo.gif");				
		if (file.exists())
		{
			logoPath = customImagePath + "/ibroker-logo.gif";
			relatedNewsPath = customImagePath + "/related-news.gif";
			if (bannerPath.startsWith("images"))
				bannerPath = customImagePath + "/ad-banner.gif";
		}

		// Set Stylesheet
		String oStylesheet = "styleSheets/" + (String) session.getAttribute("Service") + "_iservices.css";
		file = new File((String) session.getAttribute("ServerPath")+oStylesheet);
		if (!file.exists())
			oStylesheet = "styleSheets/iservices.css";

		Date dt = new Date();
%>
